<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/include/head.jsp"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title><html:text name="sys.name" /></title>
<link rel="stylesheet" href="<%=WEBPATH%>/scripts/jquery/ajaxfileupload.css" type="text/css">
<script type="text/javascript" charset="UTF-8" src="<%=WEBPATH%>/scripts/jquery/jquery.js?id=<%=generate%>"></script>
<script type="text/javascript" charset="UTF-8" src="<%=WEBPATH%>/scripts/jquery/ajaxfileupload.js?id=<%=generate%>"></script>
<script type="text/javascript" charset="UTF-8">
	function ajaxFileUpload() {
		jQuery("#loading").ajaxStart( function() {
			jQuery(this).show();
		}).ajaxComplete( function() {
			jQuery(this).hide();
		});

		jQuery.ajaxFileUpload( {
			url :'upload.crm',
			secureuri :false,
			fileElementId :'upload',
			dataType :'json',
			success : function(data, status) {
				if (typeof (data.error) != 'undefined') {
					if (data.error != '') {
						alert(data.error);
					} else {
						alert(data.msg);
					}
				}
			},
			error : function(data, status, e) {
				alert(e);
			}
		})

		return false;

	}
</script>
</head>
<body>
	<div id="wrapper">
    <div id="content">
    	<h1>Ajax File Upload Demo</h1>   	
		<img id="loading" src="<%=WEBPATH%>/images/default/extanim32.gif" style="display:none;"/>
		<form name="form" id="form" action="<%=WEBPATH%>/system/file/upload.crm" method="POST" enctype="multipart/form-data">
		<table cellpadding="0" cellspacing="0" class="tableForm">
		<tbody>	
			<tr>
				<td><input id="upload" type="file" size="45" name="upload" class="input"><input name="savePath" id="savePath" type="hidden" value="/upload"></input></td>			</tr>
		</tbody>
			<tfoot>
				<tr>
					<td><button type="submit" id="buttonUpload">Upload</button></td>
				</tr>
			</tfoot>
	
	</table>
		</form>    	
    </div>
</body>
</html>